home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
011
/
sd50.arc
/
SD50.DOC
< prev
Wrap
Text File
|
1986-05-16
|
21KB
|
488 lines
------------------------------------------------------------------------
SD: MS-DOS Sorted Directory Utility Program
Version 5.0 (C) 12-Feb-86 by John F. Stetson
------------------------------------------------------------------------
Introduction
------------------------------------------------------------------------
SD.COM is a sorted directory utility program which operates under the
Microsoft Disk Operating System Version 2 and above. There are two
different versions of the program tailored for either the Zenith Z-100
series computers or IBM-PC compatible computers.
SD provides more information than the MS-DOS resident DIR command about
the files on a disk, and allows the user to select, sort and format the
information in a variety of ways. The program uses the BIOS (rather
than DOS) for console output, as a default, which results in noticeably
faster displays. Command output can still be redirected to an output
file by using a special switch. Every effort has been made to keep the
size of the program to a minimum, for use on floppy disk based systems.
However, many of the capabilities of both MS-DOS and this program
are only fully realized when using large hard (fixed) disks with
hierarchical directory structures to organize files.
------------------------------------------------------------------------
Command Line Syntax
------------------------------------------------------------------------
The complete form of the DOS command line to run the program is:
D>sd [drive:][path][filespec] [/switches] [>[>]device/file]
In most cases, only one or two parameters are specified, so the command
syntax isn't as formidable as it may appear at first. Each of the
command line parameters is optional (as the [] characters indicate) and
may be used together in any combination or order. Spaces may also be
freely used at any point to improve readability. The various command
line parameters are described below:
[drive:]
This parameter specifies the name of the disk drive to be processed.
Typical drive letters are A: or B: for floppy disks and C: for a hard
disk on the IBM-PC/XT or E: on the Zenith Z-100. RAM (memory) disks
installed as device drivers may also be specified, and typically have
the highest drive letter currently in use by the system assigned to
them. If no drive letter is specified, the currently logged-in drive
(shown in the DOS prompt) is used.
[path]
This parameter specifies the path through the hierarchical directory
structure to the desired directory which contains the files to be
processed. The general form of the path parameter is shown below:
[path] = [\][directory][\directory]...[\directory][\]
The path name may simply be the name of the root directory (\), or the
same of a subdirectory in the root directory. The standard DOS . and ..
directory names may be used to refer to the current and parent
directories, respectively. If a path is not specified, the current
directory on the specified disk drive is used.
[filespec]
This parameter specifies which file names are to be selected for
processing from the previously specified directory (if any). A complete
(unambiguous) file name may be specified, or an ambiguous file name,
containing 'wildcard' characters (? or *) may be specified to select
several files. Either the file name (first 8 characters) or the file
extension (last 3 characters) or both may be completely omitted. In
these cases, wildcard characters are automatically used to match all
possible file names in the selected directory. You may specify leading
characters of the file names you wish to match, omitting the trailing
characters of the name, the period delimiter, and the file extension. In
this respect, SD processes file specifications differently than DIR.
[/switches]
This parameter specifies one or more 'switch' or option values which
modify the operation of the command. All switches are optional and may
be specified before the drive, path, and filespec, after them, or both
before and after. An almost infinite variety of different processing
modes may be selected by combining the various switches together in
different combinations. Each switch has a default value, which has been
carefully selected to represent the most frequently used option, for
most users. Specifying a switch overrides or 'toggles' the value of
that command option. A special 'patch' area has been provided at the
beginning of the SD.COM file so that sophisticated users can tailor the
default switch settings to their needs. If a default switch value is
modified, specification of that option will toggle the option back to
its original state, if appropriate. Detailed descriptions of all
switches are given below.
[>[>]device/file]
This parameter is actually a standard feature of DOS called redirection
of output to the 'standard output' (stdout) device. This allows the
console output generated by the program to be transmitted to either
another device (usually the printer device (PRN)), or to a disk file. By
redirecting the output of the command to a file, you can later use the
file as input to a word processor, master disk catalog system, etc. If
this parameter is specified, the /r switch must also be specified so
that the program will know to use the standard DOS console output
services instead of those in the BIOS, which cannot be redirected.
------------------------------------------------------------------------
Command Line Switches
------------------------------------------------------------------------
If a switch value other than those described below is specified, such as
/h or /x, the console screen is cleared and a summary of the command
line syntax information is displayed.
File Selection
These switches are used to further restrict which files are selected
(in addition to any filespec) based on the attributes of the files.
If a /s switch is not specified, the default is to select all of the
subdirectories and files in the specified directory, except those with
either the system or hidden attribute.
/s - Select all directories and files including system and hidden
/sd - Select only directories (no files)
/sa - Select only files with the archive attribute
/sr - Select only files with the read-only attribute
/sh - Select only files with the hidden attribute
/ss - Select only files with the system attribute
File selection switches may either be specified separately or together:
D>sd e:\dir/sa/sr - or - D>sd e:\dir/sar
When multiple /s switches are specified, the effect is 'additive'; i.e.
for the example above all files with either the archive or read-only
attribute will be selected from the specified directory.
Sort Fields
These switches specify which fields are to be used as sort 'keys' when
formatting the output information. These switches are all mutually
exclusive; i.e. only one sort switch should be specified. If no sort
switches are specified, the /f switch is the default.
/f - Ascending sort by (1) file name and (2) extension
/e - Ascending sort by (1) file extension and (2) name
/b - Ascending sort by file sizes in bytes (smallest first)
/d - Descending sort by (1) file date and (2) time (newest first)
/a - Ascending sort by (1) file date and (2) time (oldest first)
/n - No sort - display entries in directory order
Output Control
These switches are used to specify the appearance and format of the
generated output and other miscellaneous functions. The switches fall
into two categories and are described separately.
The first group of output switches selects the number of output columns.
A larger number of columns allows more files to be displayed on the
console screen at one time, at the cost of losing some of the detailed
file information. A smaller number of columns allows more detailed file
information to be displayed, at the cost of only being able to display a
limited number of files. All of these switches are mutually exclusive;
only one should be specified. The default switch is /4.
/1 - 1 output column - path, file name, size, date, time, attributes
/2 - 2 output columns - file name, size, date and time
/4 - 4 output columns - file name and size
/6 - 6 output columns - file names only
If the /1 switch is specified, the output information begins with the
specified path name. This can be useful when used as input to a disk
catalog program. The output ends with file attribute information. Each
file attribute (if any) is denoted by a letter:
A - Archive R - Read-Only H - Hidden S - System
The archive attribute is turned on when a file is written to and is
turned off by the BACKUP program when the file is backed up.
The time a file was last written to is only accurate to a resolution of
2 seconds; all values will have an even number of seconds. Files
created with early versions of DOS may not have either a date or time
stamp. In this case, these fields will appear as periods.
The next group of switches are all 'toggles'; i.e. their default state
is 'off' and they are toggled 'on' when specified. These may be used
together in all possible combinations.
/c - Clear the console screen before displaying output
/q - Quick output (no pause when the console screen fills)
/r - Generate output which is suitable for redirection
/v - Display disk volume label and creation date & time
/k - Display file sizes and disk space in rounded kbytes
/t - Display only the trailing totals summary lines
Console output may be paused by typing any character and is restarted
when another character is typed. If /q is not specified, output is
paused every time the screen fills. Typing Control-Break or Control-C
will terminate the program prematurely.
If it is desired to redirect console output to a file or to the printer,
the /r switch must be specified to tell the program to use the DOS
console output services. This applies to both the command line
redirection symbol (>) and to the Control-P printer echo function. The
program normally displays a graphics vertical bar symbol to separate
adjacent columns of output information. This is changed to the standard
ASCII (|) character if redirection is requested. Specification of the
/r switch causes the /q switch to be turned on automatically.
The /v switch causes the disk volume label (if any), and volume creation
date and time to be displayed at the beginning of the output. If the /t
switch is also specified, several disk parameter values are displayed on
a separate output line. The disk parameters displayed are:
FAT Media Byte, Bytes/Sector, Bytes/Cluster, Total Clusters on Disk
The /k switch requests that file size and disk space information be
displayed in units of kilobytes (1024 bytes), rather than the default
units of bytes. In addition, these values are rounded upward, taking
into account the allocation unit (cluster) size for the specified disk.
Typical values of cluster sizes for standard disk types are shown below:
Disk Type Capacity Cluster Size
--------- -------- ------------
SS 48 TPI 8 Sectors/Track 156K 512
SS 48 TPI 9 Sectors/Track 177K 512
DS 48 TPI 8 Sectors/Track 313K 1024
DS 48 TPI 9 Sectors/Track 354K 1024
DS 96 TPI 8 Sectors/Track 626K 2048
DS 96 TPI 9 Sectors/Track 708K 2048
Winchester (Hard) Disk 10M 4096
Winchester (Hard) Disk 20M 8192
Most DOS disks use 512 bytes per sector, and with the 12 bit File
Allocation Table entries prior to DOS V3 (4096 clusters), this requires
that progressively greater cluster sizes be used to support larger
storage devices. This can result in a substantial amount of wasted
space for large capacity hard disks with many relatively small files.
DOS V3 added support for 16 bit FAT entries which allows 65536 clusters
to be used, thus allowing a much smaller cluster size to be used with a
corresponding better utilization of disk space. For disks with a
cluster size less than 1024 bytes, the /k switch causes the file sizes
and disk space values to be displayed in bytes, but rounded up to the
cluster size, since using units of kbytes would be somewhat inaccurate.
The /t switch requests that only the trailing totals summary lines be
displayed. This option is useful when you wish to compare the total
number or sizes of files on two different disks or directories. If a
difference is detected, other switches (such as /b or /d) can be used to
determine which files are missing. A typical example is given below:
D>sd e:\asm/s/t
Path: E:\ASM Dirs: 1 Files: 10 Arch: 2 Read: 0 Hid: 0 Sys: 0
Bytes Used: 98765 Free: 234567 Total: 23511040 Thu 20-Feb-86 12:36:19
In this example, the target directory is subdirectory ASM in the root
directory on drive E:, it contains 1 subdirectory and 10 files without
the system or hidden attribute. Of these files, 2 have the archive
attribute, indicating that they have been either created or modified
since BACKUP was last run, and none of the selected files is marked
read-only. The number of bytes used by these files (ignoring the
cluster size, as discussed above) is shown, along with the disk free
space and the total disk size in bytes. The current day of the week,
date and time are also displayed. The numbers of hidden and system
files are only displayed on the first totals line if the /s, /sh, or /ss
file selection switchs are specified.
Modifying the Default Switch Values
The default switch values may be altered by using DEBUG.COM to modify
the following bytes at the beginning of the SD.COM file:
Offset Switch Default Possible Value(s)
------ ------ ------- -----------------
0102 Sort 'F' 'A', 'B', 'D', 'E', 'F', 'N'
0103 Cols '4' '1', '2', '4', '6'
0104 /c 0 0, 1=Clear console screen
0105 /k 0 0, 1=Display space in kbytes
0106 /q 0 0, 1=Quick output (no pauses)
0107 /r 0 0, 1=Allow output redirection
0108 /t 0 0, 1=Totals output lines only
0109 /v 0 0, 1=Volume label information
Example:
D>DEBUG SD.COM (load SD.COM into memory using DEBUG.COM)
-E103 '2' (Change the default number of columns to 2)
-E109 01 (Display the volume label info as a default)
-W (Write the modified file back to disk)
-Q (Exit to DOS from DEBUG)
D>sd (Execute the modified version of SD.COM)
------------------------------------------------------------------------
Examples of Use
------------------------------------------------------------------------
A>sd
Display the current directory of drive A.
B>sd/d/6
Display the current directory of drive B, sorted by descending date and
time, using the six column format (file names only).
D>sd c:\/ss/2
Display only the system files in the root directory of drive C, using
the two column output format.
C>sd b:/t
Display the totals information for the current directory of drive B.
A>sd *.asm/b
Display all files having an extension of "asm" in the current directory
of drive A and sort the output by file size.
D>sd/v/n/1/r
Display volume label information and all files in the current directory
of drive D, do not sort the file entries, use one output column, do not
pause when the console screen fills, and allow output redirection. This
combination of switches causes SD to behave similarly to DIR.
B>sd \/s/n/2
Select all files in the root directory of drive B, including those with
the hidden and/or system attribute, do not sort the file entries, and
display the output using the two column format.
B>sd/r temp.* >c:temp.dir
Select all files having a name of "temp" in the current directory of
drive B, and redirect the console output to file "c:temp.dir".
B>sd/r/1 c:\*.com >>c:temp.dir
Select all files with an extension of "com" in the root directory of
drive C, format using one output column, and redirect the console
output, appending to the file "c:temp.dir".
D>sd a:/v/t
Display volume label information, disk parameter information, and totals
information for the current directory of drive A.
A>sd t/c/k/q
Select all files in the current directory of drive A whose names begin
with "t", clear the screen before displaying output, display file size
and disk space values in kilobytes and do not pause the console output.
C>sd \/e
Display all files in the root directory of drive C sorted by file
extension and by file name.
B>sd temp
If temp is an existing subdirectory in the current directory of drive B,
then select all of the files in that directory. Otherwise, select all
files in the current directory of drive B whose names begin with "temp".
A>sd ../sar
Display all files in the parent directory of the current directory of
drive A with either the archive or read-only attribute.
B>sd ..\*.a?m/a/4
Display all files in the parent directory of the current directory of
drive B whose extensions begin with "a" and end with "m" and sort the
output by ascending date and time using the four column output format.
C>sd/r/v/1 b:\dir1\dir2\dir3\*.doc/d >prn
Select all files having an extension of "doc" in the directory
"\dir1\dir2\dir3" of drive B. Sort the output by date and time. Use
the one column output format and include volume label information.
Redirect the console output to the printer.
A>sd b:/r (Type Control-P/Return)
(console output is duplicated on the printer)
A> (Type Control-N/Return)
Display the current directory of drive B and duplicate the console
output on the printer.
------------------------------------------------------------------------
Enhancements in this Version
------------------------------------------------------------------------
This version of SD.COM (5.0) contains the following enhancements,
changes, and fixes from the previous version (4.4):
Added /1/2/4/6 output column switches and removed /l switch.
Changed default output format from 2 to 4 column display.
Added display of seconds to time information for files.
Added directory path display to output information.
Added number of directories and file types to output.
Added total disk space to output information.
Added /f sort by filename switch (default sort type).
Changed /e switch to sort by both file extension and name.
Added trailing CR/LF if /r switch is specified.
Added patch area to allow switch defaults to be changed.
Changed parsing to allow switches before and after filespec.
Fixed several miscellaneous path/filespec parsing bugs.
Changed path detection to work the same way DIR does.
Added graphics vertical bar character for IBM-PC.
Suppressed display of . and .. subdirectories.
Changed display to 25 output lines for IBM-PC.
Suppressed trailing delimiter if only one output line.
Added bad filespec message instead of syntax message.
Added /k switch to display disk space in rounded kbytes.
Expanded /s switch with d,a,r,h,s file selection values.
Added display of disk parameters if both /v and /t specified.
Removed support for operation under MS-DOS V1.
------------------------------------------------------------------------
Additional Information
------------------------------------------------------------------------
This program is in the public domain and may be freely copied as long as
the only charge is for media and reproduction costs, etc. Under no
conditions should the program either be sold for a profit or distributed
in modified form without the permission of the author. If you wish to
contact me with bug reports, suggestions for improvements, and/or
especially large financial donations, I can be reached using the
information provided below:
John F. Stetson
3144 Hewitt Ave., #143
Silver Spring, Md. 20906
(Home) (301) 460-3881 (after 7 PM)
(Work) (301) 340-4544
Compuserve [70320,353]
------------------------------------------------------------------------